import { sm3 } from 'sm-crypto'

import Config from '@/config/config'
import ajax from '@/utils/request.js'
const prefix = Config.prefix
// const suffix = Config.suffix;
const AUTH_API = {
  postToken() {
    const appid = Config.appid
    const appkey = Config.appkey
    const userId = Config.userId
    const timestamp = new Date().getTime().valueOf()
    const sign = sm3(appid + userId + timestamp + appkey)
    const params = {
      appid,
      userId,
      timestamp,
      sign,
    }
    console.log(params)
    return ajax.postForm(prefix + 'api_getToken.action', params)
  },
}
export default AUTH_API
